Skip to content

ENH: YYYYMMDD tweak version for between-tag gating (supersedes #6665)#6667

Closed
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh-tweak-version-migration
Closed

ENH: YYYYMMDD tweak version for between-tag gating (supersedes #6665)#6667
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh-tweak-version-migration

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Jul 20, 2026

Copy link
Copy Markdown
Member

Supersedes #6665 with the simpler design from its review discussion: the fourth (tweak) version component carries the YYYYMMDD (UTC) date of the most recent migration-inducing change, exported as ITK_VERSION_TWEAK / ITK_VERSION_FULL via ITKConfig.cmake, so downstream projects can gate at configure time between release tags — including during git bisect on untagged commits.

A second commit (DOC:) documents the current Python 3.11+ wrapping floor in the ITK 6 migration guide — surfaced during review of BumpVersionTweak.py's use of datetime.UTC (which is correct: pyupgrade --py311-plus and ITK_WRAP_PYTHON_MINIMUM_VERSION 3.11 both enforce it).

find_package(ITK REQUIRED)
if(ITK_VERSION_FULL VERSION_GREATER_EQUAL 6.0.0.20260715)
  set(BASELINE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/post-change)
else()
  set(BASELINE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/legacy)
endif()

Policy (documented in AGENTS.md, Documentation/AI/git-commits.md, and the migration-guide index): a change requiring a migration-guide entry or altering public API must bump ITK_VERSION_TWEAK; other key changes may. The value is never reset — release-tag version ordering expires it naturally, so no release-checklist steps are added.

Design notes vs #6665
  • Answers "is ITK at least as new as the day X landed?" (ordering, day granularity) rather than per-change identity — the trade @blowekamp and @dzenanz endorsed in ENH: Add migration sentinels for between-tag downstream gating #6665.
  • Drops all of ENH: Add migration sentinels for between-tag downstream gating #6665's apparatus: no sentinel files, no collector, no expiry tooling, no two-arm idiom (older ITK leaves ITK_VERSION_FULL unset → comparison false → legacy branch).
  • The only tool is Utilities/Maintenance/BumpVersionTweak.py: sets the tweak to today's UTC date or a given date, refuses to move it backwards, idempotent.
  • ccache-safe for free: itkConfigure.h's ITK_VERSION_STRING is major.minor only, so the tweak never reaches compiled headers.
  • ITKConfigVersion.cmake.in gains the tweak in PACKAGE_VERSION; find_package(ITK 6.0.0 EXACT) still matches via an explicit three-component equality arm.
  • Initial value 20260715 = date of the latest migration-guide change on main (fb2117c).
Verification
  • Smoke-tested a 4-component project(VERSION) with itkVersion.cmake included: PROJECT_VERSION=6.0.0.20260715, VERSION_GREATER_EQUAL gates true/false correctly on either side of the date.
  • BumpVersionTweak.py exercised: forward bump, backward-date rejection (exit 1), same-date no-op.
  • pre-commit run --all-files clean.
  • No new compiled code; CMake, docs, and one Python utility only.

Set the fourth (tweak) version component to the UTC date of the most
recent migration-inducing change and export ITK_VERSION_TWEAK and
ITK_VERSION_FULL through ITKConfig.cmake. Downstream projects building
against untagged commits (e.g. during git bisect) can gate at configure
time with ITK_VERSION_FULL VERSION_GREATER_EQUAL M.m.p.YYYYMMDD; version
ordering expires the value at each release tag with no extra checklist
steps.

Policy, recorded in AGENTS.md and the migration-guide index: a change
requiring a migration-guide entry or altering public API must bump
ITK_VERSION_TWEAK; other key changes may. EXACT find_package matches on
the three-component version are preserved.
@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation area:Python wrapping Python bindings for a class area:Documentation Issues affecting the Documentation module labels Jul 20, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review July 21, 2026 00:10
@greptile-apps

This comment was marked as resolved.

Comment thread Utilities/Maintenance/BumpVersionTweak.py

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not taken a look at Utilities/Maintenance/BumpVersionTweak.py. The rest looks good on a glance. It would be good if someone else reviewed, too.

@blowekamp

Copy link
Copy Markdown
Member

I have concerns about manually updating this one file. I think it would be nice of the tweak was just automatically determined from the last commit on the main branch or similarly.

@hjmjohnson

hjmjohnson commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

I have concerns about manually updating this one file. I think it would be nice of the tweak was just automatically determined from the last commit on the main branch or similarly.

@blowekamp I also don't like the manual updating of this file, but trying to use git commits past a tag is also very difficult. We need to have workarounds for tarballs that will not be able to compute the offests. I'll make another attempt at using git tag offsets to compute the value automatically. Previous concerns that arose when I did that resulted in me using the #6665 solution.

I'll create a PR with the git count offset from the current version tag, I know that that solution has failure modes, but perhaps the simpler user interface will make the failure modes tolerable.

@blowekamp

Copy link
Copy Markdown
Member

I have concerns about manually updating this one file. I think it would be nice of the tweak was just automatically determined from the last commit on the main branch or similarly.

@blowekamp I also don't like the manual updating of this file, but trying to use git commits past a tag is also very difficult. We need to have workarounds for tarballs that will not be able to compute the offests. I'll make another attempt at using git tag offsets to compute the value automatically. Previous concerns that arose when I did that resulted in me using the #6665 solution.

I'll create a PR with the git count offset from the current version tag, I know that that solution has failure modes, but perhaps the simpler user interface will make the failure modes tolerable.

You may want to look into the .git_archival.txt that is a something used by Python's setuptools scm. I am currently looking at using this file more in SimpleITK.

@hjmjohnson

Copy link
Copy Markdown
Member Author

Superseded by #6676, which implements @blowekamp's suggestion to determine the tweak automatically instead of hand-editing a file.

#6676 computes ITK_VERSION_TWEAK at configure time as the commit count since the closest v* tag (via git describe), and uses the .git_archival.txt / setuptools-scm export-subst mechanism you pointed to so exported tarballs — which have no .git — still compute the same value. No manual bumps, no BumpVersionTweak.py, and the changing count reaches only ITKConfig.cmake (never itkConfigure.h), so ccache is unaffected.

Closing in favor of #6676.

@hjmjohnson hjmjohnson closed this Jul 21, 2026
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request Jul 21, 2026
Set the fourth (tweak) version component at configure time to the number
of commits since the closest v* tag, instead of a hand-edited date. A
Python helper computes it from `git describe` in a working tree, and from
the git-archive-substituted `.git_archival.txt` in an exported tarball
(the setuptools-scm mechanism), falling back to 0 when neither is
available. ITK_VERSION_TWEAK and ITK_VERSION_FULL are exported through
ITKConfig.cmake for downstream between-tag gating. The value never reaches
itkConfigure.h, so the per-commit count cannot invalidate ccache.

Supersedes the manual-file approach of InsightSoftwareConsortium#6667.

Co-Authored-By: Bradley Lowekamp <321061+blowekamp@users.noreply.github.com>
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request Jul 22, 2026
Set the fourth (tweak) version component at configure time to the number
of commits since the closest v* tag, instead of a hand-edited date. A
Python helper computes it from `git describe` in a working tree, and from
the git-archive-substituted `.git_archival.txt` in an exported tarball
(the setuptools-scm mechanism), falling back to 0 when neither is
available. ITK_VERSION_TWEAK and ITK_VERSION_FULL are exported through
ITKConfig.cmake for downstream between-tag gating. The value never reaches
itkConfigure.h, so the per-commit count cannot invalidate ccache.

Supersedes the manual-file approach of InsightSoftwareConsortium#6667.

Co-Authored-By: Bradley Lowekamp <321061+blowekamp@users.noreply.github.com>
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request Jul 22, 2026
Set the fourth (tweak) version component at configure time to the number
of commits since the closest v* tag, instead of a hand-edited date. The
computation is pure CMake, so a native build gains no interpreter
dependency: `.git_archival.txt` is read first, so an exported tarball --
or a fork that commits a substituted file -- pins the count it declares,
and a working tree falls through to `git describe`. A shallow or tagless
clone has no reachable tag and yields 0.

ITK_VERSION_TWEAK and ITK_VERSION_FULL are exported through
ITKConfig.cmake for downstream between-tag gating. The value never reaches
itkConfigure.h, so the per-commit count cannot invalidate ccache.

Supersedes the manual-file approach of InsightSoftwareConsortium#6667.

Co-Authored-By: Bradley Lowekamp <321061+blowekamp@users.noreply.github.com>
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request Jul 22, 2026
Set the fourth (tweak) version component at configure time to the YYYYMMDD
date of the most recent commit, instead of a hand-edited date. The
computation is pure CMake, so a native build gains no interpreter
dependency: `.git_archival.txt` is read first, so an exported tarball --
or a fork that commits a substituted file -- pins the date it declares,
and a working tree falls through to `git log`, which succeeds even in a
shallow or tagless clone.

ITK_VERSION_TWEAK and ITK_VERSION_FULL are exported through
ITKConfig.cmake for downstream between-tag gating. The value never reaches
itkConfigure.h, so the daily change cannot invalidate ccache.

Supersedes the manual-file approach of InsightSoftwareConsortium#6667.

Co-Authored-By: Bradley Lowekamp <321061+blowekamp@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Documentation Issues affecting the Documentation module area:Python wrapping Python bindings for a class type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants